using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_UIComposite_BaseLayout_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.UIComposite.BaseLayout);

            field = type.GetField("position", flag);
            app.RegisterCLRFieldGetter(field, get_position_0);
            app.RegisterCLRFieldSetter(field, set_position_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_position_0, AssignFromStack_position_0);
            field = type.GetField("sizeDelta", flag);
            app.RegisterCLRFieldGetter(field, get_sizeDelta_1);
            app.RegisterCLRFieldSetter(field, set_sizeDelta_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_sizeDelta_1, AssignFromStack_sizeDelta_1);
            field = type.GetField("rotate", flag);
            app.RegisterCLRFieldGetter(field, get_rotate_2);
            app.RegisterCLRFieldSetter(field, set_rotate_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_rotate_2, AssignFromStack_rotate_2);

            app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone);

            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.UIComposite.BaseLayout());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.UIComposite.BaseLayout[s]);


        }

        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref huqiang.UIComposite.BaseLayout instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch(ptr_of_this_method->ObjectType)
            {
                case ObjectTypes.Object:
                    {
                        __mStack[ptr_of_this_method->Value] = instance_of_this_method;
                    }
                    break;
                case ObjectTypes.FieldReference:
                    {
                        var ___obj = __mStack[ptr_of_this_method->Value];
                        if(___obj is ILTypeInstance)
                        {
                            ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            var t = __domain.GetType(___obj.GetType()) as CLRType;
                            t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                        }
                    }
                    break;
                case ObjectTypes.StaticFieldReference:
                    {
                        var t = __domain.GetType(ptr_of_this_method->Value);
                        if(t is ILType)
                        {
                            ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                        }
                    }
                    break;
                 case ObjectTypes.ArrayReference:
                    {
                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as huqiang.UIComposite.BaseLayout[];
                        instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
                    }
                    break;
            }
        }


        static object get_position_0(ref object o)
        {
            return ((huqiang.UIComposite.BaseLayout)o).position;
        }

        static StackObject* CopyToStack_position_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.BaseLayout)o).position;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_position_0(ref object o, object v)
        {
            huqiang.UIComposite.BaseLayout ins =(huqiang.UIComposite.BaseLayout)o;
            ins.position = (UnityEngine.Vector3)v;
            o = ins;
        }

        static StackObject* AssignFromStack_position_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector3 @position = (UnityEngine.Vector3)typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            huqiang.UIComposite.BaseLayout ins =(huqiang.UIComposite.BaseLayout)o;
            ins.position = @position;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_sizeDelta_1(ref object o)
        {
            return ((huqiang.UIComposite.BaseLayout)o).sizeDelta;
        }

        static StackObject* CopyToStack_sizeDelta_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.BaseLayout)o).sizeDelta;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_sizeDelta_1(ref object o, object v)
        {
            huqiang.UIComposite.BaseLayout ins =(huqiang.UIComposite.BaseLayout)o;
            ins.sizeDelta = (UnityEngine.Vector2)v;
            o = ins;
        }

        static StackObject* AssignFromStack_sizeDelta_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector2 @sizeDelta = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            huqiang.UIComposite.BaseLayout ins =(huqiang.UIComposite.BaseLayout)o;
            ins.sizeDelta = @sizeDelta;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_rotate_2(ref object o)
        {
            return ((huqiang.UIComposite.BaseLayout)o).rotate;
        }

        static StackObject* CopyToStack_rotate_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.BaseLayout)o).rotate;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_rotate_2(ref object o, object v)
        {
            huqiang.UIComposite.BaseLayout ins =(huqiang.UIComposite.BaseLayout)o;
            ins.rotate = (UnityEngine.Quaternion)v;
            o = ins;
        }

        static StackObject* AssignFromStack_rotate_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Quaternion @rotate = (UnityEngine.Quaternion)typeof(UnityEngine.Quaternion).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            huqiang.UIComposite.BaseLayout ins =(huqiang.UIComposite.BaseLayout)o;
            ins.rotate = @rotate;
            o = ins;
            return ptr_of_this_method;
        }


        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new huqiang.UIComposite.BaseLayout();
            ins = (huqiang.UIComposite.BaseLayout)o;
            return ins;
        }


    }
}
